/**
 * @author joshua
 */

Ext.namespace('joshua.comentarios');

joshua.comentarios.Ventana=Ext.extend(Ext.Window,{
	layout      : 'fit',
	closeAction :'hide',
	resizable:false,
	maximizable:false,
	buttonAlign:'center',
	plain : true,
	width:470,
	height:250,
	title:'Agregar comentario',
	modal:true,
	iconCls:'comment_add',
	id_propietario:'',
 	initComponent:function(){
		this.comentario= new Ext.form.HtmlEditor({
			allowBlank: false,
			width:453,
			height:147,
			enableSourceEdit:false,
			enableLinks:false,
			hideLabel:true
		});

		this.tipo_comentario= new Ext.form.ComboBox({
				fieldLabel: 'Tipo entrega',
				name: 'txt_tentrega',
				store: [['0', 'Privado'], ['1', 'Publico'], ['2', 'Por conflicto']],
				emptyText:'Privado? Publico?...',
				width:90,
				value: 0,
				typeAhead: true,
				triggerAction: 'all',
				selectOnFocus: true,
				allowBlank: false,
				editable: false
		});
		var panel= new Ext.Panel({
			border:false,
			items:this.comentario,
			bbar:['<b>Tipo de comentario</b>',
				this.tipo_comentario]
		});

		this.btnOk= new Ext.Button({
			text:'<b>Guardar</b>',	
			iconCls:'save',
			scope:this//,
			//handler: //function(){
//				this._agregar(this.tipo_comentario.getValue(),this.comentario.getValue(),this.id_propietario);
/*				success:function (form,action){
 					var respuesta=Ext.util.JSON.decode(action.response.responseText);
					joshua.comentarios.grid.store.reload({params:{start: 0,limit:joshua.PAGINA_CUANTOS, condiciones:'{"txtId":"'+respuesta.id+'"}'}});
					w.limpiarForm();
					joshua.comentarios.ventana_form.hide();
				}, 
*/
	//		}
		});
 		var config={
			items:panel,
			buttons:[this.btnOk,{
			text:'<b>Cancelar</b>',
			scope:this,
			iconCls:'delete',
			handler:function(){
				this.hide();
			}
		}]
 		}//fin config


 		Ext.apply(this,Ext.apply(this.initialConfig,config));
 		joshua.comentarios.Ventana.superclass.initComponent.apply(this,arguments);
 	},//fin init
 	

 	onRender:function(){
 		joshua.comentarios.Ventana.superclass.onRender.apply(this,arguments);
 	},
	
	//funcion a remplazar
	_agregar: function (tc,c,id){
	}
	
	
});

/*
joshua.comentarios._crearFormVentana= function (){

	var v=new joshua.comentarios.Ventana();
		
	v.show(this);
}*/
